<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>xmake vs cmake对比分析</title>
    <meta name="description" content="首先，不得不承认，cmake很强大，发展了这么多年，整个生态已经相当完善，功能也相当丰富，这点xmake目前是比不了的。当初我做xmake的目的，也并不是为了完全替代cmake，这没啥意义，只是觉得cmake的语法和易用性满足不了我，我还是更喜欢更简单直观的方式去描述和维护项目，在不同平台下提供近乎一致的使用体验...">

    
    <meta name="keywords" content="xmake,lua,cmake,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/cn/2019/05/29/xmake-vs-cmake/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />

    <!-- css -->
    <link href="/css/reward.css" rel="stylesheet" type="text/css"> 




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/cn" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/?lang=0">
                    
                        <i class="fa fa-home"></i>English
                    </a>
                </li>

                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>项目
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/archive/">
                            
                        
                            <i class="fa fa-archive"></i>归档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/category/">
                            
                        
                            <i class="fa fa-th-list"></i>分类
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/tag/">
                            
                        
                            <i class="fa fa-tags"></i>标记
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/docs/">
                            
                        
                            <i class="fa fa-book"></i>文档
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="https://xmake.io/#/zh-cn/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>社区
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/donation/">
                            
                        
                            <i class="fa fa-heart"></i>捐助
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                    
                    <li>
                        
                            
                            <a href="/cn/about/">
                            
                        
                            <i class="fa fa-user"></i>关于
                        </a>
                    </li>
                    
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>xmake vs cmake对比分析</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2019-05-29
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/cn/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a-->
        <a href="/cn/tag/#lua" title="Tag: lua" rel="tag">lua</a>&nbsp;
    
        <!--a href="/tag/#cmake" title="Tag: cmake" rel="tag">cmake</a-->
        <a href="/cn/tag/#cmake" title="Tag: cmake" rel="tag">cmake</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p>首先，不得不承认，cmake很强大，发展了这么多年，整个生态已经相当完善，功能也相当丰富，这点xmake目前是比不了的。</p>

<p>当初我做xmake的目的，也并不是为了完全替代cmake，这没啥意义，只是觉得cmake的语法和易用性满足不了我，我还是更喜欢更简单直观的方式去描述和维护项目，在不同平台下提供近乎一致的使用体验。</p>

<p>因此，xmake的语法描述和使用体验还是非常好的，这也是xmake最大的亮点之一，我在这块设计上做了很多改进，为了降低学习和项目维护门槛，也更容易快速上手。</p>

<p>在这里，我只拿xmake中一些比较占优的特性去跟cmake作对比，仅仅只是为了突出说明xmake在某些方面的优势和易用性，并没有任何贬低cmake的意思。</p>

<p>如果大家看完此篇文章的对比分析，觉得xmake确实好用，能够满足部分项目维护上的需求，解决一些痛点，提高项目维护效率的话，不妨试试体验下。</p>

<ul>
  <li><a href="https://github.com/xmake-io/xmake">项目源码</a></li>
  <li><a href="https://xmake.io/#/zh/">官方文档</a></li>
  <li><a href="https://tboox.org/cn/2019/05/26/xmake-update-v2.2.6/">xmake v2.2.6 发布, Qt/Android编译支持</a></li>
</ul>

<h3 id="特性支持">特性支持</h3>

<p>我先罗列下构建工具的一些主要基础特性对比，大部分特性两者都是支持的，而xmake的优势主要还是在：语法、包仓库管理、构建体验上</p>

<table>
  <thead>
    <tr>
      <th>feature</th>
      <th>xmake</th>
      <th>cmake</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>语法</td>
      <td>Lua语法，简洁直观，快速上手</td>
      <td>DSL，复杂，学习成本高</td>
    </tr>
    <tr>
      <td>自建包仓库管理</td>
      <td>多仓库支持，可自建私有包仓库</td>
      <td>不支持</td>
    </tr>
    <tr>
      <td>第三方包管理集成</td>
      <td>vcpkg/conan/brew</td>
      <td>vcpkg/conan/其他</td>
    </tr>
    <tr>
      <td>构建行为</td>
      <td>直接构建，无依赖</td>
      <td>生成工程文件，调用第三方构建工具</td>
    </tr>
    <tr>
      <td>依赖</td>
      <td>仅依赖编译工具链</td>
      <td>依赖编译工具链+第三方构建工具</td>
    </tr>
    <tr>
      <td>查找依赖包</td>
      <td>支持</td>
      <td>支持</td>
    </tr>
    <tr>
      <td>编译器特性检测</td>
      <td>支持</td>
      <td>支持</td>
    </tr>
    <tr>
      <td>工程文件生成</td>
      <td>支持</td>
      <td>支持</td>
    </tr>
    <tr>
      <td>跨平台</td>
      <td>支持</td>
      <td>支持</td>
    </tr>
    <tr>
      <td>IDE/编辑器插件</td>
      <td>支持</td>
      <td>支持</td>
    </tr>
    <tr>
      <td>模块和插件扩展</td>
      <td>支持</td>
      <td>支持</td>
    </tr>
  </tbody>
</table>

<h3 id="语法对比">语法对比</h3>

<h4 id="空工程">空工程</h4>

<h5 id="xmake">xmake</h5>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/main.c"</span><span class="p">)</span>
</code></pre>
</div>

<h5 id="cmake">cmake</h5>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_executable</span><span class="p">(</span><span class="n">test</span> <span class="s2">""</span><span class="p">)</span>
<span class="n">target_sources</span><span class="p">(</span><span class="n">test</span> <span class="n">PRIVATE</span> <span class="n">src</span><span class="o">/</span><span class="n">main</span><span class="p">.</span><span class="n">c</span><span class="p">)</span>
</code></pre>
</div>

<h4 id="源文件添加">源文件添加</h4>

<h5 id="xmake-1">xmake</h5>

<p>xmake支持通配符匹配的方式，添加一批源文件进来，<code class="highlighter-rouge">*.c</code>匹配当前目录下所有文件，<code class="highlighter-rouge">**.c</code>匹配递归目录下所有文件。</p>

<p>这种方式，对于平常项目中新增一些文件编译，就不需要每次修改xmake.lua了，自动同步，可以节省不少时间。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"test/*.c"</span><span class="p">,</span> <span class="s2">"example/**.cpp"</span><span class="p">)</span>
</code></pre>
</div>

<p>xmake的<code class="highlighter-rouge">add_files()</code>是非常灵活强大的，不仅可以支持各种不同类型源文件添加，还可以在添加的同时排除一些指定文件。</p>

<p>比如：递归添加src下的所有c文件，但是不包括src/impl/下的所有c文件。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_files</span><span class="p">(</span><span class="s2">"src/**.c|impl/*.c"</span><span class="p">)</span>
</code></pre>
</div>

<p>更多关于这个接口的使用说明，见相关文档：<a href="https://xmake.io/#/zh/manual?id=targetadd_files">add_files接口文档</a></p>

<h5 id="cmake-1">cmake</h5>

<p>cmake似乎需要先遍历文件列表到对应变量，再添加到对应的target中去才行，稍微繁琐些。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_executable</span><span class="p">(</span><span class="n">test</span> <span class="s2">""</span><span class="p">)</span>
<span class="n">file</span><span class="p">(</span><span class="n">GLOB</span> <span class="n">SRC_FILES</span> <span class="s2">"src/*.c"</span><span class="p">)</span>
<span class="n">file</span><span class="p">(</span><span class="n">GLOB</span> <span class="n">TEST_FILES</span> <span class="s2">"test/*.c"</span><span class="p">)</span>
<span class="n">file</span><span class="p">(</span><span class="n">GLOB_RECURSE</span> <span class="n">EXAMPLE_FILES</span> <span class="s2">"example/*.cpp"</span><span class="p">)</span>
<span class="n">target_sources</span><span class="p">(</span><span class="n">test</span> <span class="n">PRIVATE</span> 
    <span class="err">$</span><span class="p">{</span><span class="n">SRC_FILES</span><span class="p">}</span>
    <span class="err">$</span><span class="p">{</span><span class="n">TEST_FILES</span><span class="p">}</span>
    <span class="err">$</span><span class="p">{</span><span class="n">EXAMPLE_FILES</span><span class="p">}</span>
<span class="p">)</span>
</code></pre>
</div>

<h4 id="条件编译">条件编译</h4>

<h5 id="xmake-2">xmake</h5>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/main.c"</span><span class="p">)</span>
    <span class="k">if</span> <span class="n">is_plat</span><span class="p">(</span><span class="s2">"macosx"</span><span class="p">,</span> <span class="s2">"linux"</span><span class="p">)</span> <span class="k">then</span>
        <span class="n">add_defines</span><span class="p">(</span><span class="s2">"TEST1"</span><span class="p">,</span> <span class="s2">"TEST2"</span><span class="p">)</span>
    <span class="k">end</span>
    <span class="k">if</span> <span class="n">is_plat</span><span class="p">(</span><span class="s2">"windows"</span><span class="p">)</span> <span class="ow">and</span> <span class="n">is_mode</span><span class="p">(</span><span class="s2">"release"</span><span class="p">)</span> <span class="k">then</span>
        <span class="n">add_cxflags</span><span class="p">(</span><span class="s2">"-Ox"</span><span class="p">,</span> <span class="s2">"-fp:fast"</span><span class="p">)</span>
    <span class="k">end</span>
</code></pre>
</div>

<h5 id="cmake-2">cmake</h5>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_executable</span><span class="p">(</span><span class="n">test</span> <span class="s2">""</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="n">APPLE</span> <span class="n">OR</span> <span class="n">LINUX</span><span class="p">)</span>
    <span class="n">target_compile_definitions</span><span class="p">(</span><span class="n">test</span> <span class="n">PRIVATE</span> <span class="n">TEST1</span> <span class="n">TEST2</span><span class="p">)</span>
<span class="n">endif</span><span class="p">()</span>
<span class="k">if</span> <span class="p">(</span><span class="n">WIN32</span><span class="p">)</span>
    <span class="n">target_compile_options</span><span class="p">(</span><span class="n">test</span> <span class="n">PRIVATE</span> <span class="err">$</span><span class="o">&lt;</span><span class="err">$</span><span class="o">&lt;</span><span class="n">CONFIG</span><span class="p">:</span><span class="n">Release</span><span class="o">&gt;</span><span class="p">:</span><span class="o">-</span><span class="n">Ox</span> <span class="o">-</span><span class="n">fp</span><span class="p">:</span><span class="n">fast</span><span class="o">&gt;</span><span class="p">)</span>
<span class="n">endif</span><span class="p">()</span>
<span class="n">target_sources</span><span class="p">(</span><span class="n">test</span> <span class="n">PRIVATE</span>
    <span class="n">src</span><span class="o">/</span><span class="n">main</span><span class="p">.</span><span class="n">c</span>
<span class="p">)</span>
</code></pre>
</div>

<h4 id="自定义脚本">自定义脚本</h4>

<h5 id="xmake-3">xmake</h5>

<p>xmake可以在编译构建的不同阶段（包括编译、安装、打包、运行），方便的插入一段自定义脚本来处理自己的逻辑，比如编译完成之后打印一行输出：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">after_build</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="nb">print</span><span class="p">(</span><span class="s2">"target file: %s"</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span><span class="n">targetfile</span><span class="p">())</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>或者自定义运行和安装逻辑：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">on_install</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="n">os</span><span class="p">.</span><span class="n">cp</span><span class="p">(</span><span class="n">target</span><span class="p">:</span><span class="n">targetfile</span><span class="p">(),</span> <span class="s2">"/usr/local/bin"</span><span class="p">)</span>
    <span class="k">end</span><span class="p">)</span>
    <span class="n">on_run</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="n">os</span><span class="p">.</span><span class="n">run</span><span class="p">(</span><span class="s2">"%s --help"</span><span class="p">,</span> <span class="n">target</span><span class="p">:</span><span class="n">targetfile</span><span class="p">())</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>在自定义脚本中，用户可以写各种复杂脚本，通过<a href="https://xmake.io/#/zh/manual?id=import">import</a>接口，可以导入各种扩展模块来使用。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">before_build</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"net.http"</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"devel.git"</span><span class="p">)</span>
        <span class="n">http</span><span class="p">.</span><span class="n">download</span><span class="p">(</span><span class="s2">"https://xmake.io"</span><span class="p">,</span> <span class="s2">"/tmp/index.html"</span><span class="p">)</span>
        <span class="n">git</span><span class="p">.</span><span class="n">clone</span><span class="p">(</span><span class="s2">"git@github.com:tboox/xmake.git"</span><span class="p">,</span> <span class="p">{</span><span class="n">depth</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="n">branch</span> <span class="o">=</span> <span class="s2">"master"</span><span class="p">,</span> <span class="n">outputdir</span> <span class="o">=</span> <span class="s2">"/tmp/xmake"</span><span class="p">})</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<h5 id="cmake-3">cmake</h5>

<p>cmake也可以通过<code class="highlighter-rouge">add_custom_command</code>来实现：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_executable</span><span class="p">(</span><span class="n">test</span> <span class="s2">""</span><span class="p">)</span>
<span class="n">target_sources</span><span class="p">(</span><span class="n">test</span> <span class="n">PRIVATE</span> <span class="n">src</span><span class="o">/</span><span class="n">main</span><span class="p">.</span><span class="n">c</span><span class="p">)</span>
<span class="n">add_custom_command</span><span class="p">(</span><span class="n">TARGET</span> <span class="n">test</span> <span class="n">POST_BUILD</span>
    <span class="n">COMMENT</span> <span class="s2">"hello cmake!"</span>
<span class="p">)</span>
</code></pre>
</div>

<p>不过看了下，不同阶段，自定义脚本的方式并不完全一样，<code class="highlighter-rouge">add_custom_command</code>只能用于构建阶段的自定义，如果要对安装阶段进行自定义，得：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">install</span><span class="p">(</span><span class="n">SCRIPT</span> <span class="n">cmake_install</span><span class="p">.</span><span class="n">cmake</span><span class="p">)</span>
</code></pre>
</div>

<p>并且只能整个替换安装逻辑，无法对安装前后的实现一些自定义逻辑，另外像打包、运行等其他阶段的自定义似乎不支持。</p>

<h3 id="构建方式">构建方式</h3>

<h4 id="编译默认平台">编译默认平台</h4>

<h5 id="xmake-4">xmake</h5>

<p>通常情况，编译默认平台执行敲xmake，执行构建期间，xmake不会依赖其他第三方构建工具，连make也不依赖，也不会生成IDE/Makefile文件，
而是直接调用的编译工具链进行编译，默认会根据cpu核数自动开启多任务加速构建。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>xmake
</code></pre>
</div>

<h5 id="cmake-4">cmake</h5>

<p>而cmake的通常是先生成对应IDE/Makefile等第三方构建文件，然后调用make/msbuild等第三方构建工具去编译。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>cmake .
cmake --build .
</code></pre>
</div>

<h4 id="编译指定平台">编译指定平台</h4>

<h5 id="xmake-5">xmake</h5>

<p>xmake可以以近乎一致的方式快速切换不同平台和架构来编译。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>xmake f -p [iphoneos|android|linux|windows|mingw] -a [arm64|armv7|i386|x86_64]
xmake
</code></pre>
</div>

<h5 id="cmake-5">cmake</h5>

<p>cmake似乎对不同平台和架构的编译配置方式，差异性还是有些的，需要花点时间研究下才行。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>cmake -G Xcode -DIOS_ARCH="arm64" .
cmake --build .
</code></pre>
</div>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>cmake -G "Visual Studio 9 2008" -A x64
cmake --build .
</code></pre>
</div>

<p>像android平台编译，配置ndk的方式似乎也很繁琐。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>cmake .. -DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK%\build\cmake\android.toolchain.cmake -DCMAKE_SYSTEM_NAME="Android" -DANDROID_NDK=%ANDROID_NDK% -DANDROID_TOOLCHAIN=clang -DANDROID_PLATFORM=android-24
</code></pre>
</div>

<h4 id="安装目标">安装目标</h4>

<h5 id="xmake-6">xmake</h5>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>xmake install 
</code></pre>
</div>

<h5 id="cmake-6">cmake</h5>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>cmake -P cmake_install.cmake
</code></pre>
</div>

<h4 id="运行目标">运行目标</h4>

<h5 id="xmake-7">xmake</h5>

<p>大部分情况下，xmake不需要写自定义脚本就可以直接加载运行编译生成的目标程序。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>xmake run 
</code></pre>
</div>

<h5 id="cmake-7">cmake</h5>

<p>cmake我没找到可以快速运行指定目标程序的方式，但是应该可以通过写一个自定义脚本去加载运行它。</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>cmake -P cmake_run.cmake
</code></pre>
</div>

<h3 id="依赖支持">依赖支持</h3>

<h4 id="查找依赖库">查找依赖库</h4>

<h5 id="xmake-8">xmake</h5>

<p>xmake也是支持跟cmake的<code class="highlighter-rouge">find_package</code>类似的接口去直接查找系统库，然后集成使用，找到库后，会自动追加includedirs, links, linkdirs等相关设置。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">on_load</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="n">target</span><span class="p">:</span><span class="n">add</span><span class="p">(</span><span class="n">find_packages</span><span class="p">(</span><span class="s2">"openssl"</span><span class="p">,</span> <span class="s2">"zlib"</span><span class="p">))</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<h5 id="cmake-8">cmake</h5>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_executable</span><span class="p">(</span><span class="n">test</span> <span class="n">main</span><span class="p">.</span><span class="n">c</span><span class="p">)</span>

<span class="n">find_package</span><span class="p">(</span><span class="n">OpenSSL</span> <span class="n">REQUIRED</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="n">OpenSSL_FOUND</span><span class="p">)</span>
    <span class="n">target_include_directories</span><span class="p">(</span><span class="n">test</span> <span class="err">$</span><span class="p">{</span><span class="n">OpenSSL_INCLUDE_DIRS</span><span class="p">})</span>
    <span class="n">target_link_libraries</span><span class="p">(</span><span class="n">test</span> <span class="err">$</span><span class="p">{</span><span class="n">OpenSSL_LIBRARIES</span><span class="p">})</span>
<span class="n">endif</span><span class="p">()</span> 

<span class="n">find_package</span><span class="p">(</span><span class="n">Zlib</span> <span class="n">REQUIRED</span><span class="p">)</span>
<span class="k">if</span> <span class="p">(</span><span class="n">Zlib_FOUND</span><span class="p">)</span>
    <span class="n">target_include_directories</span><span class="p">(</span><span class="n">test</span> <span class="err">$</span><span class="p">{</span><span class="n">Zlib_INCLUDE_DIRS</span><span class="p">})</span>
    <span class="n">target_link_libraries</span><span class="p">(</span><span class="n">test</span> <span class="err">$</span><span class="p">{</span><span class="n">Zlib_LIBRARIES</span><span class="p">})</span>
<span class="n">endif</span><span class="p">()</span> 
</code></pre>
</div>

<h4 id="使用第三方库conan">使用第三方库(Conan)</h4>

<h5 id="xmake-9">xmake</h5>

<p>xmake会自动调用conan工具去下载安装openssl库，然后集成使用，只需要执行xmake命令即可完成编译。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"conan::OpenSSL/1.0.2n@conan/stable"</span><span class="p">,</span> <span class="p">{</span><span class="n">alias</span> <span class="o">=</span> <span class="s2">"openssl"</span><span class="p">})</span> 
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"openssl"</span><span class="p">)</span>
</code></pre>
</div>

<h5 id="cmake-9">cmake</h5>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="k">if</span><span class="p">(</span><span class="n">NOT</span> <span class="n">EXISTS</span> <span class="s2">"${CMAKE_BINARY_DIR}/conan.cmake"</span><span class="p">)</span>
   <span class="n">message</span><span class="p">(</span><span class="n">STATUS</span> <span class="s2">"Downloading conan.cmake from https://github.com/conan-io/cmake-conan"</span><span class="p">)</span>
   <span class="n">file</span><span class="p">(</span><span class="n">DOWNLOAD</span> <span class="s2">"https://github.com/conan-io/cmake-conan/raw/v0.14/conan.cmake"</span>
                 <span class="s2">"${CMAKE_BINARY_DIR}/conan.cmake"</span><span class="p">)</span>
<span class="n">endif</span><span class="p">()</span>

<span class="n">include</span><span class="p">(</span><span class="err">$</span><span class="p">{</span><span class="n">CMAKE_BINARY_DIR</span><span class="p">}</span><span class="o">/</span><span class="n">conan</span><span class="p">.</span><span class="n">cmake</span><span class="p">)</span>

<span class="n">conan_cmake_run</span><span class="p">(</span><span class="n">REQUIRES</span> <span class="n">OpenSSL</span><span class="o">/</span><span class="mi">1</span><span class="p">.</span><span class="mi">0</span><span class="p">.</span><span class="mi">2</span><span class="n">n</span><span class="err">@</span><span class="n">conan</span><span class="o">/</span><span class="n">stable</span>
                <span class="n">BASIC_SETUP</span> 
                <span class="n">BUILD</span> <span class="n">missing</span><span class="p">)</span>

<span class="n">add_executable</span><span class="p">(</span><span class="n">test</span> <span class="n">main</span><span class="p">.</span><span class="n">c</span><span class="p">)</span>
<span class="n">target_link_libraries</span><span class="p">(</span><span class="n">main</span> <span class="err">$</span><span class="p">{</span><span class="n">CONAN_LIBS</span><span class="p">})</span>
</code></pre>
</div>

<h4 id="使用内建包仓库">使用内建包仓库</h4>

<h5 id="xmake-10">xmake</h5>

<p>xmake有自建的包仓库，虽然现在里面包还不是很多，但后期会不断完善：<a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a></p>

<p>我们只需要添加相关需要的包就行了，非常方便，并且支持多版本选择和语义版本控制哦。</p>

<p>甚至有些常用包支持多平台集成使用，例如：zlib库等，即使编译android/iphoneos/mingw等平台，也都可以直接下载安装使用。</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"libuv master"</span><span class="p">,</span> <span class="s2">"ffmpeg"</span><span class="p">,</span> <span class="s2">"zlib 1.20.*"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"tbox &gt;1.6.1"</span><span class="p">,</span> <span class="p">{</span><span class="n">optional</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span> <span class="n">debug</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"libuv"</span><span class="p">,</span> <span class="s2">"ffmpeg"</span><span class="p">,</span> <span class="s2">"tbox"</span><span class="p">,</span> <span class="s2">"zlib"</span><span class="p">)</span>
</code></pre>
</div>

<p>执行xmake命令后，会去自动从仓库中下载对应的包然后编译安装，集成链接进来，效果如下：</p>

<div align="center">
<img src="https://xmake.io/assets/img/index/package_manage.png" width="80%" />
</div>

<p>除了官方的包仓库，用户也可以自己创建多个私有仓库，用来集成使用一些私有包，这对于公司内部项目的依赖维护还是很有帮助的。</p>

<p>我们只需要在xmake.lua加上自己的私有仓库地址就行了：</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_repositories</span><span class="p">(</span><span class="s2">"my-repo git@github.com:myrepo/xmake-repo.git"</span><span class="p">)</span>
</code></pre>
</div>

<p>或者直接命令行添加：</p>

<div class="language-console highlighter-rouge"><pre class="highlight"><code>xmake repo --add my-repo git@github.com:myrepo/xmake-repo.git
</code></pre>
</div>

<p>关于这块的详细说明可以看下相关文档：</p>

<ul>
  <li><a href="https://xmake.io/#/zh/?id=%E8%BF%9C%E7%A8%8B%E4%BE%9D%E8%B5%96%E6%A8%A1%E5%BC%8F">远程依赖模式</a></li>
  <li><a href="https://xmake.io/#/zh/manual?id=add_requires">add_requires接口说明</a></li>
</ul>

<p>最后，附带一张xmake的依赖包管理架构图：</p>

<div align="center">
<img src="https://xmake.io/assets/img/index/package_arch.png" width="80%" />
</div>

<h5 id="cmake-10">cmake</h5>

<p>这块我没看到cmake有支持，不过cmake我用得并不多，如果有写的不对的地方，大家可以指正。</p>

        </article>
        <hr>

        <!-- baidu ads -->
        

        <!-- reward -->
        <div style="text-align: center;">
            <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
              <span>赏</span>
            </button>
            <div id="QR" style="display: none;">
                <div id="wechat" style="display: inline-block">
                  <img id="wechat_qr" src="/static/img/weixin.png" alt="WeChat Pay"/>
                  <p>微信打赏</p>
                </div>
                <div id="alipay" style="display: inline-block">
                  <img id="alipay_qr" src="/static/img/alipay.png" alt="Alipay"/>
                  <p>支付宝打赏</p>
                </div>
            </div>
        </div>

        
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
                    
                    <h2 id="english">English</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/2019/05/29/xmake-vs-cmake/">xmake vs cmake
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
        
            </ul>
        

        
        
            
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">相关文章</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/17/xmake-update-v2.6.2/">xmake v2.6.2 发布，新增 Linux 内核驱动模块构建支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 发布，使用 Lua5.4 运行时，Rust 和 C++ 混合编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 发布，改进 C++20 模块，并支持 Nim, Keil MDK 和 Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 发布，新增 Pascal/Swig 程序和 Lua53 运行时支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/cn/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 发布，包依赖锁定和 Vala/Metal 语言编译支持
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
            
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>上一篇</strong> <a href="/cn/2019/05/26/xmake-update-v2.2.6/">xmake v2.2.6 发布, Qt/Android编译支持</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        <p><strong>下一篇</strong> <a href="/cn/2019/06/17/xmake-update-v2.2.7/">xmake v2.2.7 发布, 改进Cuda项目构建</a></p>
        
    </div>
</div>


        <h2 id="comments">评论</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,       
  language: 'zh-CN',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">

            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    内容
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#english">English</a></li>
                    <li><a href="#similar_posts">相关文章</a></li>
                    <li><a href="#comments">评论</a></li>
                </ul>
            </div>


            <!-- baidu ads -->
            
            
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    链接
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- xmake courses -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    xmake 入门课程
                </div>
                <a href="https://xmake.io/#/zh-cn/about/course" target="_blank">
                <img src="/static/img/xmake-course.png" alt="course" width="256" height="193">
                </a>
            </div>

            <!-- qqgroup -->
            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    技术交流群（QQ）
                </div>
                <img src="/static/img/qqgroup.png" alt="qqgroup" width="256" height="284">
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
